package cn.yunhe.test;

import cn.yunhe.model.Page;
import cn.yunhe.model.Person;
import cn.yunhe.service.impl.PersonServiceImpl;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author Created by zs on 2017/12/20.
 */

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring/spring-mybatis.xml"})
public class Demo {

    @Resource
    private PersonServiceImpl personServiceImpl=null;


    @Test
    public void test1(){
        Page page = null;
         Map<String, Object> cond = new HashMap<String, Object>();
         cond.put("pageSize", 3);
         cond.put("pageNum", 1);
         Person person = new Person();
         person.setName("裴");
          cond.put("person", person);

          page = personServiceImpl.queryLikePersons(cond);


          List<Person> list =page.getResult();
                 System.out.println(list);
          for(Person p :list){
              System.out.println(p.getName());
          }




    }



}
